package com.fyyg.common.util;

import java.util.Random;

public class RandomUserName {
	
	// 中国移动：
    private static final String[] first_name =  new String[]{"134","135","136","137","138","139","150","151","152","157","158","159","182","183","184","187","178","188","147"};
    // 中国联通
    private static final String[] tel_head = new String[]{"130","131","132","145","155","156","176","185","186"};
    // 中国电信
    private static final String[] email_suffix = new String[]{"133","153","177","180","181","189","134"};


    private Random random = new Random();

    public static void main(String[] args) {
        RandomUserName ran = new RandomUserName();
        for (int i = 0; i < 100; i++) {
            System.out.println(ran.generate());
        }
    }

    public String generate(){
        StringBuilder uName = new StringBuilder();
        int randomType = random.nextInt(Integer.MAX_VALUE)%3;
        switch (randomType) {
            case 0: 
            	uName.append(first_name[random.nextInt(Integer.MAX_VALUE)%first_name.length])
                .append(random.nextInt(Integer.MAX_VALUE)%10)
                .append(random.nextInt(Integer.MAX_VALUE)%10)
                .append(random.nextInt(Integer.MAX_VALUE)%10)
                .append(random.nextInt(Integer.MAX_VALUE)%10)
                .append(random.nextInt(Integer.MAX_VALUE)%10)
                .append(random.nextInt(Integer.MAX_VALUE)%10)
                .append(random.nextInt(Integer.MAX_VALUE)%10)
                .append(random.nextInt(Integer.MAX_VALUE)%10);
                break;
            case 1:
            	uName.append(tel_head[random.nextInt(Integer.MAX_VALUE)%tel_head.length])
	                .append(random.nextInt(Integer.MAX_VALUE)%10)
	                .append(random.nextInt(Integer.MAX_VALUE)%10)
	                .append(random.nextInt(Integer.MAX_VALUE)%10)
	                .append(random.nextInt(Integer.MAX_VALUE)%10)
	                .append(random.nextInt(Integer.MAX_VALUE)%10)
	                .append(random.nextInt(Integer.MAX_VALUE)%10)
	                .append(random.nextInt(Integer.MAX_VALUE)%10)
	                .append(random.nextInt(Integer.MAX_VALUE)%10);
                break;
            case 2: 
            	uName.append(email_suffix[random.nextInt(Integer.MAX_VALUE)%email_suffix.length])
                .append(random.nextInt(Integer.MAX_VALUE)%10)
                .append(random.nextInt(Integer.MAX_VALUE)%10)
                .append(random.nextInt(Integer.MAX_VALUE)%10)
                .append(random.nextInt(Integer.MAX_VALUE)%10)
                .append(random.nextInt(Integer.MAX_VALUE)%10)
                .append(random.nextInt(Integer.MAX_VALUE)%10)
                .append(random.nextInt(Integer.MAX_VALUE)%10)
                .append(random.nextInt(Integer.MAX_VALUE)%10);
                break;
            default:
                break;
        }
        return uName.toString();
    }
}
